package com.tkwayne.ftpclient.config;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;

/**
 * Ftp连接池配置项
 * @author wayne
 * @description 
 * @date 2019/7/20 16:38 
 */
public class FtpPoolConfig extends GenericObjectPoolConfig{

    private	String host;
	//端口
    private	int port;
	//用户名
    private	String userName;
	//密码
    private	String password;
	//ftp 连接超时时间 毫秒
    private int connectTimeOut = 5000;
    //系统编码
    private String controlEncoding = "utf-8";
	//缓冲区大小
    private int bufferSize = 1024;
	//传输数据格式   2表binary二进制数据
    private int fileType = 2;
	//读取数据传输超时时间
    private int dataTimeout = 120000;

    private boolean useEPSVWithIPv4 = false;
	//是否启用被动模式
    private boolean passiveMode = true;

    //MaxClientsPerIP[同一个IP允许8个链接]
	//MaxClientsNumber[最大的客户端数量]
	//最大空闲链接数
    private int maxIdle;
    //最大链接数
    private int maxTotal;
    //当连接池资源maxTotal耗尽时，调用者最大阻塞的时间[ms] -1表示阻塞
    private long maxWaitMillis;
	//运行一次空闲连接回收器[ms]
    private long timeBetweenEvictionRunsMillis;
	//池中的连接空闲被回收[ms]
    private long minEvictableIdleTimeMillis;
	//指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
    private boolean testWhileIdle;

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getConnectTimeOut() {
		return connectTimeOut;
	}

	public void setConnectTimeOut(int connectTimeOut) {
		this.connectTimeOut = connectTimeOut;
	}

	public String getControlEncoding() {
		return controlEncoding;
	}

	public void setControlEncoding(String controlEncoding) {
		this.controlEncoding = controlEncoding;
	}

	public int getBufferSize() {
		return bufferSize;
	}

	public void setBufferSize(int bufferSize) {
		this.bufferSize = bufferSize;
	}

	public int getFileType() {
		return fileType;
	}

	public void setFileType(int fileType) {
		this.fileType = fileType;
	}

	public int getDataTimeout() {
		return dataTimeout;
	}

	public void setDataTimeout(int dataTimeout) {
		this.dataTimeout = dataTimeout;
	}

	public boolean isUseEPSVWithIPv4() {
		return useEPSVWithIPv4;
	}

	public void setUseEPSVWithIPv4(boolean useEPSVWithIPv4) {
		this.useEPSVWithIPv4 = useEPSVWithIPv4;
	}

	public boolean isPassiveMode() {
		return passiveMode;
	}

	public void setPassiveMode(boolean passiveMode) {
		this.passiveMode = passiveMode;
	}

	@Override
	public int getMaxIdle() {
		return maxIdle;
	}

	@Override
	public void setMaxIdle(int maxIdle) {
		this.maxIdle = maxIdle;
	}

	@Override
	public int getMaxTotal() {
		return maxTotal;
	}

	@Override
	public void setMaxTotal(int maxTotal) {
		this.maxTotal = maxTotal;
	}

	@Override
	public long getMaxWaitMillis() {
		return maxWaitMillis;
	}

	public void setMaxWaitMillis(long maxWaitMillis) {
		this.maxWaitMillis = maxWaitMillis;
	}

	@Override
	public long getTimeBetweenEvictionRunsMillis() {
		return timeBetweenEvictionRunsMillis;
	}

	@Override
	public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
		this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
	}

	@Override
	public long getMinEvictableIdleTimeMillis() {
		return minEvictableIdleTimeMillis;
	}

	@Override
	public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
		this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
	}

	@Override
	public boolean getTestWhileIdle() {
		return testWhileIdle;
	}

	@Override
	public void setTestWhileIdle(boolean testWhileIdle) {
		this.testWhileIdle = testWhileIdle;
	}
}
